Project  = Web-Forkers
ProjURL  = http://code.google.com/p/web-forkers/
Version  = 0.02(preview)
Date     = $(shell date '+%Y%m%d')
Year     = $(shell date '+%Y')
Build    = v$(Version) ($(Date))
Header   = $(Project) v$(Version) ($(Date))

ifdef GCC_PATH 
compiler = $(GCC_PATH)
else
compiler = java -jar $(HOME)/bin/compiler.jar
endif
src       = src
tests     = tests
web_forkers = $(src)/web-forkers.js
forker_helpers = $(src)/forker_helpers.js
web_forkers_js = web-forkers.js

swf_header = 1:1:1:FFFFFF

.PHONY: tests

all: $(web_forkers_js)

$(web_forkers_js): $(web_forkers) $(forker_helpers)
	echo '/*! $(Header)' > $(web_forkers_js)
	echo '	- copyright 2009-$(Year), Evgeny Burzak <$(ProjURL)>' >> $(web_forkers_js)
	echo '	- released under the MIT License <http://www.opensource.org/licenses/mit-license.php>\n*/' >> $(web_forkers_js)
	$(compiler) --js $(web_forkers) --js $(forker_helpers) >> $(web_forkers_js)
		
tests:
	haxe -cp $(src) -cp $(tests) -swf9 $(tests)/hello.swf -swf-header $(swf_header) -main Hello
	haxe -cp $(src) -cp $(tests) -swf9 $(tests)/colorize.swf -swf-header $(swf_header) -main Colorize

clean:
	rm -f $(web_forkers_js)
